import Cookies from 'js-cookie'

const TokenKey = 'token'

export function getToken () {
  let res = ''
  try {
    res = JSON.parse(Cookies.get(TokenKey))
  } catch (err) {
    res = ''
  }
  return res
}

export function setToken (token) {
  // console.log(token)
  Cookies.set(TokenKey, JSON.stringify(token))
}

export function removeToken () {
  return Cookies.remove(TokenKey)
}
